package com.szy.douyou_comment.dao;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author sunziyan
 * @date 2022/4/11
 */
@Data
@TableName("comments")
public class Comment {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long commentId;

    /**
     * 关联文章id
     */
    private Long articleId;

    /**
     * 关联用户id
     */
    private Long userId;

    /**
     * 评论内容
     */
    private String commentContent;

    /**
     * 回复评论id
     */
    private Long commentFatherId;



    /**
     * 评论时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 逻辑删除
     */
    @TableLogic
    private Integer deleted;

    /*
    ---------------------------------
     */

    /**
     * 孩子评论
     */
    @TableField(exist = false)
    private List<Comment> children;


    @TableField(exist = false)
    private String userName;

    @TableField(exist = false)
    private String userAvatar;


    @TableField(exist = false)
    private String fatherName;

    @TableField(exist = false)
    private String fatherAvatar;

    @TableField(exist = false)
    private String articleTitle;

}
